<template>
  <a-table :data-source="data" :scroll="{y:600}" class="scroll-y-table">
    <a-table-column :width="100" key="Id" title="编号" data-index="Id">
      <template v-slot="{index}">{{ index + 1 }}</template>
    </a-table-column>
    <a-table-column key="name" title="用户名" data-index="user_name"/>
    <a-table-column key="name" title="观看视频" data-index="name"/>
    <a-table-column key="operation" title="登录时间" data-index="time"></a-table-column>
  </a-table>
</template>

<script setup lang="ts">
import {ref} from "vue";
import {getVideoLog} from "@/apis/log";
import type {VideoLog} from '@/types/Log';

const data = ref<VideoLog[]>([]);
const lodTableData = async () =>{
  const {data: {data: v}} = await getVideoLog();
  v.forEach((v: VideoLog) => v.time = new Date(v.time).toLocaleString());
  data.value = v;
}
lodTableData()

</script>

<style scoped>

</style>